from re import S
import pymongo

from freeProxyWebs.sixsixProxy import SixSixProxy
from freeProxyWebs.eightnineProxy import EightNineProxy
from freeProxyWebs.cloudProxy import CloudProxy
from freeProxyWebs.xiaohuanProxy import XiaohuanProxy
from freeProxyWebs.kuaiProxy import KuaiProxy
from judge.judger import Judger

urlsixsix = 'http://www.66ip.cn/'
urleightnine = 'http://www.89ip.cn/'
urlcloud = 'http://www.ip3366.net/free/'
urlxiaohuan = 'https://ip.ihuan.me/'
urlkuai = 'https://www.kuaidaili.com/free/'

def saveproxy():
    sixsix = SixSixProxy(urlsixsix)
    eightnine = EightNineProxy(urleightnine)
    cloud = CloudProxy(urlcloud)
    xiaohuan = XiaohuanProxy(urlxiaohuan)
    kuai = KuaiProxy(urlkuai)

    sixsix.init_proxy_pool()
    eightnine.init_proxy_pool()
    cloud.init_proxy_pool()
    xiaohuan.init_proxy_pool()
    kuai.init_proxy_pool()


def selectproxy():
    client = pymongo.MongoClient('localhost',27017)

    judge = Judger(client)
    judge.judge_proxies()

if __name__ == '__main__':
    #saveproxy()
    selectproxy()

